home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Ubuntu 9.10 PL / karmelkowy-koliberek-desktop-9.10-i386-PL.iso / casper / filesystem.squashfs / usr / lib / byobu / logo < prev    next >
Text File  |  2009-10-11  |  3KB  |  119 lines

  1. #!/bin/sh -e
  2. #
  3. #    logo: determine which logo to use
  4. #    Copyright (C) 2008 Canonical Ltd.
  5. #
  6. #    Authors: Dustin Kirkland <kirkland@canonical.com>
  7. #
  8. #    This program is free software: you can redistribute it and/or modify
  9. #    it under the terms of the GNU General Public License as published by
  10. #    the Free Software Foundation, version 3 of the License.
  11. #
  12. #    This program is distributed in the hope that it will be useful,
  13. #    but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. #    GNU General Public License for more details.
  16. #
  17. #    You should have received a copy of the GNU General Public License
  18. #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
  19.  
  20. PKG="byobu"
  21.  
  22. if [ "$1" = "--detail" ]; then
  23.     MARKUP="false"
  24.     exit 0
  25. else
  26.     MARKUP="true"
  27. fi
  28.  
  29. print_logo() {
  30.     distro=`echo "$1" | sed 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/' `
  31.     case "$distro" in
  32.         *ubuntu*)
  33.             $MARKUP && printf "\005{=b kr}\\\\\005{= ky}o\005{=b kY}/" || printf "\\o/"
  34.         ;;
  35.         *altlinux*)
  36.             logo="alt"
  37.             $MARKUP && printf "\005{= Yk}$logo" || printf "$logo"
  38.         ;;
  39.          *arch*)
  40.             logo=" A "
  41.             $MARKUP && printf "\005{=b wb}$logo" || printf "$logo"
  42.         ;;
  43.         *centos*)
  44.             logo="****"
  45.             $MARKUP && printf "\005{= gw}*\005{= mw}*\005{= yw}*\005{= bw}*\005{=b Wk}" || printf "$logo"
  46.         ;;
  47.         *debian*)
  48.             logo=" @ "
  49.             $MARKUP && printf "\005{= wr}$logo" || printf "$logo"
  50.         ;;
  51.         *fedora*)
  52.             logo=" f "
  53.             $MARKUP && printf "\005{=b bw}$logo" || printf "$logo"
  54.         ;;
  55.         *foresight*)
  56.             logo="<@>"
  57.             $MARKUP && printf "\005{=b Wg}$logo" || printf "$logo"
  58.         ;;
  59.         *gentoo*)
  60.             logo=" > "
  61.             $MARKUP && printf "\005{=b cw}$logo" || printf "$logo"
  62.         ;;
  63.         *mandriva*)
  64.             logo=" (* "
  65.             $MARKUP && printf "\005{=b kc} (\005{=b ky}* " || printf "$logo"
  66.         ;;
  67.         *redhat*)
  68.             logo=" RH "
  69.             $MARKUP && printf "\005{= Rk}$logo" || printf "$logo"
  70.         ;;
  71.         *rockhopper*)
  72.             logo="palm"
  73.             $MARKUP && printf "\005{=b YW}$logo" || printf "$logo"
  74.         ;;
  75.         *slackware*)
  76.             logo=",S "
  77.             $MARKUP && printf "\005{=u Bk}$logo" || printf "$logo"
  78.         ;;
  79.         *suse*)
  80.             logo="SuSE"
  81.             $MARKUP && printf "\005{= Wg}$logo" || printf "$logo"
  82.         ;;
  83.         *xandros*)
  84.             logo=" X "
  85.             $MARKUP && printf "\005{= Wr}$logo" || printf "$logo"
  86.         ;;
  87.         *)
  88.             logo="|B|"
  89.             $MARKUP && printf "\005{=b kW}$logo" || printf " $logo "
  90.         ;;
  91.     esac
  92. }
  93.  
  94. if [ -n "$LOGO" ]; then
  95.     # Allow users to define their own logo in $HOME/.$PKG/status
  96.     printf "%s" "$LOGO" && exit 0 || true
  97. fi
  98.  
  99. if [ -n "$DISTRO" ]; then
  100.     # Allow manual override of distro in $HOME/.$PKG/status
  101.     print_logo "$DISTRO" && exit 0 || true
  102. fi
  103.  
  104. if [ -r "/etc/issue" ]; then
  105.     # Otherwise, check /etc/issue
  106.     distro=`cat /etc/issue`
  107.     print_logo "$distro" && exit 0 || true
  108. fi
  109.  
  110. # This can be a very expensive operation, do it only
  111. # if all other methods fail
  112. if which lsb_release >/dev/null 2>&1; then
  113.     distro=`lsb_release -s -a 2>/dev/null`
  114.     print_logo "$distro" && exit 0 || true
  115. fi
  116.  
  117. # No idea!
  118. printf "|B|"
  119.